package com.linkhub.oms.common.enums.mp;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.linkhub.oms.common.enums.IEnumConvert;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @Description: CustomerBusinessStatusEnum
 * @Author: echo
 * @Date: 2024/3/28 17:08
 * @Version: 1.0
 */
@Getter
@AllArgsConstructor
public enum CustomerBusinessStatusEnum implements IEnumConvert<Integer> {

    // 客户业务页签状态：1-待匹配;2-待付款;3-待审核;4-待处理;5-已作废;6-非ShipO订单;7-已取消; 20-履约中;30-异常；35-待发货;40-已发货；45-搁置中
    TO_BE_MATCHED(1, "待匹配"),
    DUE(2, "待付款"),
    PENDING_CHECK(3, "待审核"),
    PENDING_PROCESSED(4, "待处理"),
    VOID(5, "已取消"),
    NON_SHIPO_ORDERS(6, "非ShipO订单"),
    IN_PERFORMANCE(20, "履约中"),
    ABNORMAL(30, "异常"),
    // 待发货状态为虚拟状态，实际在数据库中记录为履约中-有货、履约中-缺货，为以上两个状态的合集,此值不会记录在数据库中
    WAIT_DELIVER(35, "待发货"),
    TRACKING(40, "已发货"),
    ON_HOLD(45, "搁置中"),
    ;

    @EnumValue
    private final Integer code;
    private final String desc;

    public static boolean isPendingProcessed(CustomerBusinessStatusEnum businessStatus) {
        return checkBizStatus(businessStatus, PENDING_PROCESSED);
    }

    public static boolean checkBizStatus(CustomerBusinessStatusEnum businessStatus, CustomerBusinessStatusEnum target) {
        return Objects.equals(businessStatus, target);
    }



}
